package com.bw.sign

import androidx.lifecycle.MutableLiveData
import com.bw.lib_base.entity.SignBean
import com.bw.lib_base.entity.SignBeanItem
import com.bw.lib_base.mvvm.BaseViewModel
import com.bw.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import okhttp3.RequestBody
import javax.inject.Inject
@HiltViewModel
class SignViewModel @Inject constructor(val apiService: ApiService): BaseViewModel() {
    val signData = MutableLiveData<SignBeanItem>()
    fun sign(body: SignBeanItem){
        httpRequest({apiService.sign(toBody(body))}, signData::postValue)
    }

    val hisData = MutableLiveData<SignBean>()
    fun history(userId:Int){
        httpRequest({apiService.signHistory(userId)},hisData::postValue)
    }
}